package com.xpu.pms.comm.http;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.Map;

@Data
@Accessors(chain = true)
public class QueryPage {
    private PageInfo page;
    //后续补充查询条件

    /**
     * 根据PageInfo里边的的index,size生成数据库分页需要的Map
     * @return
     */
    public Map<String,Object> toMap(){
        Map<String,Object> params=new HashMap<>();
        int index=(page.getIndex()-1)*5;
        params.put("index",index);
        params.put("size",page.getSize());
        return params;
    }

    public Page toPage(){
        return new Page(page.getIndex(),page.getSize());
    }
}
